// Copyright 2013 Square, Inc.
package org.assertj.ohos.api.accounts;

import ohos.account.app.AppAccount;
import org.assertj.core.api.AbstractAssert;

import static org.assertj.core.api.Assertions.assertThat;

/** Assertions for {@link AppAccount} instances. */
public class AccountAssert extends AbstractAssert<AccountAssert, AppAccount> {
  public AccountAssert(AppAccount actual) {
    super(actual, AccountAssert.class);
  }

  public AccountAssert hasName(String name) {
    isNotNull();
    String actualName = actual.getName();
    assertThat(actualName) //
        .overridingErrorMessage("Expected name <%s> but was <%s>.", name, actualName) //
        .isEqualTo(name);
    return this;
  }

  // TODO: wang, should change this method to hasOwner(String owner)
  public AccountAssert hasType(String type) {
    isNotNull();
    String actualType = actual.getOwner();
    assertThat(actualType) //
        .overridingErrorMessage("Expected type <%s> but was <%s>.", type, actualType) //
        .isEqualTo(type);
    return this;
  }

  public AccountAssert hasOwner(String owner) {
    isNotNull();
    String actualOwner = actual.getOwner();
    assertThat(actualOwner) //
        .overridingErrorMessage("Expected type <%s> but was <%s>.", owner, actualOwner) //
        .isEqualTo(owner);
    return this;
  }
}
